//
//  SettingActivityTableViewCell.m
//  CLBrowser
//
//  Created by 梁慧聪 on 2017/1/18.
//  Copyright © 2021年 梁慧聪. All rights reserved.
//

#import "CLSettingActivityTableViewCell.h"

@interface CLSettingActivityTableViewCell ()

@end

@implementation CLSettingActivityTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    
    [self.activityIndicatorView setHidesWhenStopped:YES];
}

- (void)setCalculateBlock:(SettingNoParamsBlock)block{
    if (block) {
        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
            NSString *result = block();
            if ([result isKindOfClass:[NSString class]]) {
                WEAK_SELF;
                dispatch_main_safe_async(^{
                    STRONG_SELF;
                    if (strongSelf) {
                        [strongSelf.activityIndicatorView stopAnimating];
                        strongSelf.rightLabel.text = result;
                    }
                });
            }
        });
    }
}

@end
